<h1 class="page-header">
    <small>分组管理</small>
</h1>
<hr/>
<div class="panel panel-inverse" data-sortable-id="form-stuff-5">
    <div class="panel-heading">
        <h4 class="panel-title">分组查询</h4>
    </div>
    <div class="panel-body">
        <form id="activityGroupForm" name="activityGroupForm" method="post" class="form">
            <div class="search-rows">
                <div class="col-md-3 item">
                     <input type="text" placeholder="分组ID" class="form-control" style="width: 90%" id="EQ_id" name="EQ_id">
                </div>
                <div class="col-md-3 item">
                     <input type="text" placeholder="分组名称" class="form-control" style="width: 90%" id="LIKE_name" name="LIKE_name">
                </div>
                <div class="col-md-6 item">
                    <button type="button"
                            class="btn btn-success btn-sm"
                            onclick="postDataByForm('${rc.contextPath}/backend/couponGroup/queryList','activityGroupList','activityGroupForm')">
                            <i class="fa fa-search"></i>
                        查询
                    </button>
                    <button type="reset"
                            class="btn btn-success btn-sm">
                            <i class="fa fa-remove"></i>
                        重置
                    </button>
                    <button type="button"
                            class="btn btn-danger btn-sm"
                            onclick="getData('${rc.contextPath}/backend/couponGroup/add','displayArea')">
                        <i class="fa fa-plus"></i>
                        新增分组
                    </button>
                </div>
            </div>
        </form>
    </div>
</div>
<div id="activityGroupList"></div>
<script type="application/javascript">
    $(function () {
        postDataByForm('${rc.contextPath}/backend/couponGroup/queryList', 'activityGroupList', 'activityGroupForm');
    });

    /**
     * 删除分组
     * @param groupId 组ID
     */
    function removeCouponGroup(groupId) {
        layer.confirm('确定要删除该分组吗？', {
            btn: ['确定', '取消']
        }, function () {
            $.ajax({
                type: "GET",
                url: "${rc.contextPath}/backend/couponGroup/delete/" + groupId,
                success: function (data) {
                    if (data.result) {
                        $.close();
                        postDataByForm('${rc.contextPath}/backend/couponGroup/queryList', 'activityGroupList', 'activityGroupForm')
                    } else {
                        $.close();
                        layer.alert(data.msg);
                    }
                }
            })
        }, function () {
            $.close();
        });
    }
</script>